home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWContxt.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.1 KB  |  165 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWContxt.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWCONTXT_H
  11. #define FWCONTXT_H
  12.  
  13. // ----- Graphic Includes -----
  14.  
  15. #ifndef FWGC_H
  16. #include "FWGC.h"
  17. #endif
  18.  
  19. #ifndef SLGDEV_H
  20. #include "SLGDev.h"
  21. #endif
  22.  
  23. #ifndef FWGRUTIL_H
  24. #include "FWGrUtil.h"
  25. #endif
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class ODFacet;
  32. class ODShape;
  33. class ODWindow;
  34.  
  35. class FW_CView;
  36.  
  37. //========================================================================================
  38. //    class FW_CWindowContext
  39. //========================================================================================
  40.  
  41. class FW_CWindowContext : public FW_CGraphicContext
  42. {
  43. public:
  44.  
  45.     FW_DECLARE_AUTO(FW_CWindowContext)
  46.     
  47.     FW_CWindowContext(Environment* ev, ODWindow *odWindow);    
  48.     FW_CWindowContext(Environment* ev, ODFacet *odFacet);
  49.     virtual    ~ FW_CWindowContext();
  50.  
  51.     virtual void    Reset();
  52.     
  53. protected:
  54.     void        InitWindowContext(Environment* ev, ODWindow *odWindow);
  55.  
  56.     ODShape*    AcquireClipShape(Environment* ev);
  57.     
  58. private:
  59.     ODWindow*            fODWindow;
  60.     FW_HGDevice            fTempDevice;    //     We need a temporary device in the case where the root
  61.                                         //    facet is not one of ours
  62. };
  63.  
  64. //========================================================================================
  65. //    class FW_CFrameContext
  66. //========================================================================================
  67. //    The frame context is used for example by the FW_CViewAs to draw the icon or thumbnail
  68. //    in frame coordinates
  69.  
  70. class FW_CFrameContext : public FW_CGraphicContext
  71. {
  72. public:
  73.  
  74.     FW_DECLARE_AUTO(FW_CFrameContext)
  75.     
  76.     FW_CFrameContext(Environment* ev, ODFacet *facet, ODShape* invalidShape = NULL);
  77.     virtual ~ FW_CFrameContext();
  78.  
  79.     virtual void    Reset();
  80.  
  81.     ODFacet*    GetFacet() const
  82.                     {return fFacet;}                
  83. private:
  84.     ODFacet*                fFacet;
  85. };
  86.  
  87. //========================================================================================
  88. //    class FW_CPlatformGraphicContext
  89. //========================================================================================
  90.  
  91. class FW_CPlatformGraphicContext : public FW_CGraphicContext
  92. {
  93. public:
  94.  
  95.     FW_DECLARE_AUTO(FW_CPlatformGraphicContext)
  96.     
  97.     FW_CPlatformGraphicContext(Environment* ev, ODFacet *facet, ODShape* invalidShape = NULL);
  98.     virtual ~ FW_CPlatformGraphicContext();
  99.  
  100.     virtual void    Reset();
  101.  
  102.     ODFacet*    GetFacet() const
  103.                     {return fFacet;}
  104.  
  105. protected:
  106. #ifdef FW_BUILD_MAC
  107.     void        PrivMacAlignOrigin(Environment* ev);
  108. #endif
  109.  
  110. private:
  111.     ODFacet*    fFacet;
  112. #ifdef FW_BUILD_MAC
  113.     GrafPtr        fMacPort;
  114.     Point        fMacOrigin;
  115. #endif
  116. };
  117.  
  118. //========================================================================================
  119. // class FW_CViewContext
  120. //========================================================================================
  121.  
  122. class FW_CViewContext : public FW_CGraphicContext
  123. {
  124. // ----- Initialization/destruction
  125. public:
  126.  
  127.     FW_DECLARE_AUTO(FW_CViewContext)
  128.     
  129.     FW_CViewContext(Environment* ev, FW_CView* view, ODFacet* facet, ODShape* invalidShape = NULL);
  130.     virtual            ~FW_CViewContext();
  131.     
  132.     void            Reset();
  133.  
  134.     FW_CView*        GetView() const;
  135.     ODFacet*        GetFacet() const;
  136.  
  137. protected:
  138.     ODTransform*    PrivAcquireTransform(Environment* ev);
  139.     ODShape*        PrivAcquireClipShape(Environment* ev);
  140.  
  141. private:
  142.     FW_CView*            fView;
  143.     ODFacet*            fFacet;
  144. };
  145.  
  146. //----------------------------------------------------------------------------------------
  147. // FW_CViewContext::GetView
  148. //----------------------------------------------------------------------------------------
  149.  
  150. inline FW_CView* FW_CViewContext::GetView() const
  151. {
  152.     return fView;
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. // FW_CViewContext::GetFacet
  157. //----------------------------------------------------------------------------------------
  158.  
  159. inline ODFacet* FW_CViewContext::GetFacet() const
  160. {
  161.     return fFacet;
  162. }
  163.  
  164. #endif
  165.